Merge "Use the specified page ID for LinksDeletionUpdate"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 14 Jun 2016 22:05:30 +0000 (22:05 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 14 Jun 2016 22:05:30 +0000 (22:05 +0000)
1  2 
includes/deferred/LinksDeletionUpdate.php

@@@ -27,28 -27,23 +27,28 @@@ class LinksDeletionUpdate extends SqlDa
        protected $page;
        /** @var integer */
        protected $pageId;
 +      /** @var string */
 +      protected $timestamp;
  
        /**
         * @param WikiPage $page Page we are updating
         * @param integer|null $pageId ID of the page we are updating [optional]
 +       * @param string|null $timestamp TS_MW timestamp of deletion
         * @throws MWException
         */
 -      function __construct( WikiPage $page, $pageId = null ) {
 +      function __construct( WikiPage $page, $pageId = null, $timestamp = null ) {
                parent::__construct( false ); // no implicit transaction
  
                $this->page = $page;
-               if ( $page->exists() ) {
+               if ( $pageId ) {
+                       $this->pageId = $pageId; // page ID at time of deletion
+               } elseif ( $page->exists() ) {
                        $this->pageId = $page->getId();
-               } elseif ( $pageId ) {
-                       $this->pageId = $pageId;
                } else {
                        throw new InvalidArgumentException( "Page ID not known. Page doesn't exist?" );
                }
 +
 +              $this->timestamp = $timestamp ?: wfTimestampNow();
        }
  
        public function doUpdate() {
                                [
                                        'rc_type != ' . RC_LOG,
                                        'rc_namespace' => $title->getNamespace(),
 -                                      'rc_title' => $title->getDBkey()
 +                                      'rc_title' => $title->getDBkey(),
 +                                      'rc_timestamp < ' .
 +                                              $this->mDb->addQuotes( $this->mDb->timestamp( $this->timestamp ) )
                                ],
                                __METHOD__
                        );
                        'wiki' => $this->mDb->getWikiID(),
                        'job'  => new JobSpecification(
                                'deleteLinks',
 -                              [ 'pageId' => $this->pageId ],
 +                              [ 'pageId' => $this->pageId, 'timestamp' => $this->timestamp ],
                                [ 'removeDuplicates' => true ],
                                $this->page->getTitle()
                        )